package org.deng.learn.designpattern.prototype;

import java.util.LinkedList;
import java.util.List;

/**
 * @author DengLibin
 * @Description
 * @Date 2019/2/26 0026 17:39
 */
public class Rectangle implements PolygonPrototype {
    private List<Point> points;
    public Rectangle(List<Point> points){
        this.points = points;
    }
    @Override
    public PolygonPrototype clone() {
        List<Point> list = new LinkedList<>();
        for(Point point : points){
            list.add(new Point(point.getX(), point.getY()));
        }
        return new Rectangle(list);
    }
}
